package com.sky.mapper;

import com.sky.anno.AutoFill;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    @Select("select * from employee where username=#{username}")
    Employee findByUsername(String username);

    List<Employee> findByPage(String name);
    @Select("select * from employee where id_number=#{idNumber}")
    Employee findByIdNumber(String idNumber);
    @Select("select * from employee where phone=#{phone}")
    Employee findByPhone(String phone);
    @AutoFill("insert")
    @Insert("insert into employee values (null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser} )")
    void save(Employee employee);
    @Select("select * from employee where id=#{id}")
    Employee findById(Long id);
    @AutoFill("update")
    void update(Employee employee);
}
